import { Injectable } from '@nestjs/common';
import { AlbumDto } from '../dto/album.dto';

@Injectable()
export class AlbumService {
  private albums: AlbumDto[] = [
    { id: 1, name: '周杰伦', singer: '双截棍', releaseYear: 1982 },
    { id: 2, name: '周杰伦', singer: '七里香', releaseYear: 1980 },
    { id: 3, name: '周杰伦', singer: '叶惠美', releaseYear: 1973 },
  ];

  findAll(): AlbumDto[] {
    return this.albums;
  }

  findOne(id: number): AlbumDto | string {
    const album = this.albums.find(album => album.id === id);
    return album || '专辑不存在';
  }
}